<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <p>handler.defineProperty()方法用于拦截对象的Object.defineProperty()操作</p>

    <script>
        var proxy1 = new Proxy({}, {
            defineProperty: function (target, property, descriptor) {
                debugger;
                console.log('called: ' + property);
                return true;
            }
        })

        var desc = {
            configurable: true,
            enumerable: true,
            value: 20
        };
        Object.defineProperty(proxy1, 'a', desc); // "called: a"
    </script>
</body>

</html>